// custom-tab-bar/index.js
Component({
    data: {
        selected: 0,
        color: '#aaaaaa',
        selectedColor: '#51a938',
        list: [
            {
                regular: true,
                pagePath: "/pages/home/home",
                iconPath: "../assets/home.png",
                selectedIconPath: "../assets/home-s.png",
                text: "主页"
            },
            {
                regular: true,
                pagePath: "/pages/correctbook/correctbook",
                iconPath: "../assets/book.png",
                selectedIconPath: "../assets/book-s.png",
                text: "错题本"
            },
            {
                regular: true,
                pagePath: "/pages/person-info/person-info",
                iconPath: "../assets/user.png",
                selectedIconPath: "../assets/user-s.png",
                text: "我"
            }
        ]
    },

    attached() {},

    methods: {
        switchTab(e) {
            let data = e.currentTarget.dataset;
            const url = data.path;
            this.setData({
                selected: data.index
            });
            wx.switchTab({
                url
            });
        }
    }
})
